# Description:
#   generated integration test for one specific kernel in a model.
load(
    "//tensorflow/lite/micro:build_def.bzl",
    "generate_cc_arrays",
    "tflm_cc_library",
    "tflm_cc_test",
)

package(
    default_visibility = ["//visibility:public"],
    # Disabling layering_check because of http://b/177257332
    features = ["-layering_check"],
    licenses = ["notice"],
)

generate_cc_arrays(
    name = "generated_sub0_model_data_cc",
    src = "sub0.tflite",
    out = "sub0_model_data.cc",
)

generate_cc_arrays(
    name = "generated_sub0_model_data_hdr",
    src = "sub0.tflite",
    out = "sub0_model_data.h",
)

generate_cc_arrays(
    name = "generated_sub1_model_data_cc",
    src = "sub1.tflite",
    out = "sub1_model_data.cc",
)

generate_cc_arrays(
    name = "generated_sub1_model_data_hdr",
    src = "sub1.tflite",
    out = "sub1_model_data.h",
)

generate_cc_arrays(
    name = "generated_sub2_model_data_cc",
    src = "sub2.tflite",
    out = "sub2_model_data.cc",
)

generate_cc_arrays(
    name = "generated_sub2_model_data_hdr",
    src = "sub2.tflite",
    out = "sub2_model_data.h",
)

generate_cc_arrays(
    name = "generated_sub3_model_data_cc",
    src = "sub3.tflite",
    out = "sub3_model_data.cc",
)

generate_cc_arrays(
    name = "generated_sub3_model_data_hdr",
    src = "sub3.tflite",
    out = "sub3_model_data.h",
)

generate_cc_arrays(
    name = "generated_sub4_model_data_cc",
    src = "sub4.tflite",
    out = "sub4_model_data.cc",
)

generate_cc_arrays(
    name = "generated_sub4_model_data_hdr",
    src = "sub4.tflite",
    out = "sub4_model_data.h",
)

generate_cc_arrays(
    name = "generated_sub0_input0_int16_test_data_cc",
    src = "sub0_input0_int16.csv",
    out = "sub0_input0_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub0_input0_int16_test_data_hdr",
    src = "sub0_input0_int16.csv",
    out = "sub0_input0_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub0_input1_int16_test_data_cc",
    src = "sub0_input1_int16.csv",
    out = "sub0_input1_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub0_input1_int16_test_data_hdr",
    src = "sub0_input1_int16.csv",
    out = "sub0_input1_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub0_golden_int16_test_data_cc",
    src = "sub0_golden_int16.csv",
    out = "sub0_golden_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub0_golden_int16_test_data_hdr",
    src = "sub0_golden_int16.csv",
    out = "sub0_golden_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub1_input0_int16_test_data_cc",
    src = "sub1_input0_int16.csv",
    out = "sub1_input0_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub1_input0_int16_test_data_hdr",
    src = "sub1_input0_int16.csv",
    out = "sub1_input0_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub1_input1_int16_test_data_cc",
    src = "sub1_input1_int16.csv",
    out = "sub1_input1_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub1_input1_int16_test_data_hdr",
    src = "sub1_input1_int16.csv",
    out = "sub1_input1_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub1_golden_int16_test_data_cc",
    src = "sub1_golden_int16.csv",
    out = "sub1_golden_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub1_golden_int16_test_data_hdr",
    src = "sub1_golden_int16.csv",
    out = "sub1_golden_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub2_input0_int16_test_data_cc",
    src = "sub2_input0_int16.csv",
    out = "sub2_input0_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub2_input0_int16_test_data_hdr",
    src = "sub2_input0_int16.csv",
    out = "sub2_input0_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub2_input1_int16_test_data_cc",
    src = "sub2_input1_int16.csv",
    out = "sub2_input1_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub2_input1_int16_test_data_hdr",
    src = "sub2_input1_int16.csv",
    out = "sub2_input1_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub2_golden_int16_test_data_cc",
    src = "sub2_golden_int16.csv",
    out = "sub2_golden_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub2_golden_int16_test_data_hdr",
    src = "sub2_golden_int16.csv",
    out = "sub2_golden_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub3_input0_int16_test_data_cc",
    src = "sub3_input0_int16.csv",
    out = "sub3_input0_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub3_input0_int16_test_data_hdr",
    src = "sub3_input0_int16.csv",
    out = "sub3_input0_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub3_input1_int16_test_data_cc",
    src = "sub3_input1_int16.csv",
    out = "sub3_input1_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub3_input1_int16_test_data_hdr",
    src = "sub3_input1_int16.csv",
    out = "sub3_input1_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub3_golden_int16_test_data_cc",
    src = "sub3_golden_int16.csv",
    out = "sub3_golden_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub3_golden_int16_test_data_hdr",
    src = "sub3_golden_int16.csv",
    out = "sub3_golden_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub4_input0_int16_test_data_cc",
    src = "sub4_input0_int16.csv",
    out = "sub4_input0_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub4_input0_int16_test_data_hdr",
    src = "sub4_input0_int16.csv",
    out = "sub4_input0_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub4_input1_int16_test_data_cc",
    src = "sub4_input1_int16.csv",
    out = "sub4_input1_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub4_input1_int16_test_data_hdr",
    src = "sub4_input1_int16.csv",
    out = "sub4_input1_int16_test_data.h",
)

generate_cc_arrays(
    name = "generated_sub4_golden_int16_test_data_cc",
    src = "sub4_golden_int16.csv",
    out = "sub4_golden_int16_test_data.cc",
)

generate_cc_arrays(
    name = "generated_sub4_golden_int16_test_data_hdr",
    src = "sub4_golden_int16.csv",
    out = "sub4_golden_int16_test_data.h",
)

tflm_cc_library(
    name = "models_and_testdata",
    srcs = [
        "generated_sub0_golden_int16_test_data_cc",
        "generated_sub0_input0_int16_test_data_cc",
        "generated_sub0_input1_int16_test_data_cc",
        "generated_sub0_model_data_cc",
        "generated_sub1_golden_int16_test_data_cc",
        "generated_sub1_input0_int16_test_data_cc",
        "generated_sub1_input1_int16_test_data_cc",
        "generated_sub1_model_data_cc",
        "generated_sub2_golden_int16_test_data_cc",
        "generated_sub2_input0_int16_test_data_cc",
        "generated_sub2_input1_int16_test_data_cc",
        "generated_sub2_model_data_cc",
        "generated_sub3_golden_int16_test_data_cc",
        "generated_sub3_input0_int16_test_data_cc",
        "generated_sub3_input1_int16_test_data_cc",
        "generated_sub3_model_data_cc",
        "generated_sub4_golden_int16_test_data_cc",
        "generated_sub4_input0_int16_test_data_cc",
        "generated_sub4_input1_int16_test_data_cc",
        "generated_sub4_model_data_cc",
    ],
    hdrs = [
        "generated_sub0_golden_int16_test_data_hdr",
        "generated_sub0_input0_int16_test_data_hdr",
        "generated_sub0_input1_int16_test_data_hdr",
        "generated_sub0_model_data_hdr",
        "generated_sub1_golden_int16_test_data_hdr",
        "generated_sub1_input0_int16_test_data_hdr",
        "generated_sub1_input1_int16_test_data_hdr",
        "generated_sub1_model_data_hdr",
        "generated_sub2_golden_int16_test_data_hdr",
        "generated_sub2_input0_int16_test_data_hdr",
        "generated_sub2_input1_int16_test_data_hdr",
        "generated_sub2_model_data_hdr",
        "generated_sub3_golden_int16_test_data_hdr",
        "generated_sub3_input0_int16_test_data_hdr",
        "generated_sub3_input1_int16_test_data_hdr",
        "generated_sub3_model_data_hdr",
        "generated_sub4_golden_int16_test_data_hdr",
        "generated_sub4_input0_int16_test_data_hdr",
        "generated_sub4_input1_int16_test_data_hdr",
        "generated_sub4_model_data_hdr",
    ],
)

tflm_cc_test(
    name = "integration_test",
    srcs = [
        "integration_tests.cc",
    ],
    deps = [
        ":models_and_testdata",
        "//python/tflite_micro:python_ops_resolver",
        "//tensorflow/lite/micro:micro_framework",
        "//tensorflow/lite/micro:micro_log",
        "//tensorflow/lite/micro:micro_resource_variable",
        "//tensorflow/lite/micro:op_resolvers",
        "//tensorflow/lite/micro:recording_allocators",
        "//tensorflow/lite/micro/testing:micro_test",
    ],
)
